package com.genesis.web.controller.omsorder;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.genesis.mall.common.Result;
import com.genesis.mall.entity.OmsOrderSetting;
import com.genesis.mall.service.IOmsOrderSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单设置表 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-08-01
 */
@RestController
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {

    @Autowired
    private IOmsOrderSettingService omsOrderSettingService;

    /**
     * 获取指定订单设置
     * @param id
     * @return   完成
     */
    @GetMapping("/{id}")
    public Result<OmsOrderSetting> getById(@PathVariable Long id){

        return Result.success(omsOrderSettingService.getById(id));

    }


    /**
     * 修改指定订单设置
     * @param id
     * @param omsOrderSetting
     * @return   完成
     */
    @PostMapping("/update/{id}")
    public Result updateById(@PathVariable Long id ,
                             @RequestBody OmsOrderSetting omsOrderSetting){

        LambdaQueryWrapper<OmsOrderSetting> lqw = new LambdaQueryWrapper<>();
        lqw.eq(OmsOrderSetting::getId,id);
        omsOrderSettingService.update(omsOrderSetting,lqw);
        return  Result.success();

    }
}
